package com.viknix.threadpool.manager.server.dependence.monitor.event;

import java.io.Serializable;
import java.util.concurrent.atomic.AtomicLong;

/**
 * @Author: Dongqi
 * @Date: 2021/11/1 18:16
 * @Version 1.0
 * @Description: 事件源抽象层
 */
public abstract class Event implements Serializable {

    private static final long serialVersionUID = 7099057708183571938L;

    private static final AtomicLong SEQUENCE = new AtomicLong(0);

    private final long sequence = SEQUENCE.getAndIncrement();

    /**
     * 获取事件序列号，单调递增
     *
     * @return 事件序列号
     */
    public long sequence() {
        return sequence;
    }
}
